package org.kumas.sgrpc.rpc.protocol.sgrpc;

import java.util.Map;

import org.kumas.sgrpc.rpc.Exporter;
import org.kumas.sgrpc.rpc.Invoker;
import org.kumas.sgrpc.rpc.protocol.AbstractExporter;

/**
 *
 * @author KumasZhang
 * @version 1.0
 * @since 2021-07-27 15:09
 */
public class SgrpcExporter<T>  extends AbstractExporter<T> {
    private final String key;

    private final Map<String, Exporter<?>> exporterMap;

    public SgrpcExporter(Invoker<T> invoker, String key, Map<String, Exporter<?>> exporterMap) {
        super(invoker);
        this.key = key;
        this.exporterMap = exporterMap;
    }

    @Override
    public void afterUnExport() {
        exporterMap.remove(key);
    }
}
